<template>
  <div>
    <div>消息公告</div>
    <div>
      <div>
        <el-table :data="tableData" @row-click="getDetail" :height="height" style="width: 100%">
          <el-table-column prop="id" label="id" width="120"> </el-table-column>
          <el-table-column prop="title" label="标题" width="80">
          </el-table-column>
          <el-table-column prop="from" label="来源"> </el-table-column>
          <el-table-column prop="createTime" label="创建时间">
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>


export default {
  data() {
    return {
      height: "",
      tableData: [
        {
          id: "",
          title: "test",
          from: "",
          createTime: "",
        },
      ],
    };
  },
  mounted() {
    let that = this;
    // 初始化
    window.fullHeight = document.documentElement.clientHeight;
    window.fullWidth = document.documentElement.clientWidth;
    that.windowHeight = window.fullHeight; // 高
    that.windowWidth = window.fullWidth; // 宽
    this.height = that.windowHeight/100*40;
    this.$axios({
      method: "GET",
      url: "http://81.70.192.34:8088/notice/search",
    }).then(res => {
        console.log(res.data.data.records)
        this.tableData = res.data.data.records
        console.log(this.tableData)
      })
      .catch((error) => {
        console.error(error);
      });
  },
  methods: {
    getDetail(row, event, column) {
      this.$router.push({
        path: '/notice/detail',
        query: {
          notice_id: row.id
        }
      })
      console.log(row)
    }
  }
};
</script>
